﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace S2_Xxxx_XxxNetApi
{
    public static class ByteExtension
    {
        /// <summary>
        ///  byte[] 转字符串
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns>ae00cf</returns>
        public static string ToHexString(this byte[] bytes)
        {
            int nNumberChars = bytes.Length << 1;
            string hexString = string.Empty;
            if (bytes != null)
            {
                StringBuilder strB = new StringBuilder();

                for (int i = 0; i < bytes.Length; i++)
                {
                    strB.Append(bytes[i].ToString("x2"));
                }
                hexString = strB.ToString();
            }
            return hexString;
        }
    }

}
